package com.main.organizationandplatformmanagement.interfaces.assembler;

import com.main.common.base.base.BaseAssembler;
import com.main.common.base.base.BaseAssemblerFactory;
import com.main.organizationandplatformmanagement.domain.organization.entity.OrganizationModelAtomType;
import com.main.organizationandplatformmanagement.domain.organization.entity.OrganizationModelAtoms;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationModelAtomTypeDTO;
import com.main.organizationandplatformmanagement.interfaces.dto.AddOrganizationModelAtomsDTO;
import com.main.organizationandplatformmanagement.interfaces.dto.OrganizationModelAtomsDTO;
import jakarta.validation.constraints.NotNull;

public class OrganizationModelAtomsAssembler {
    private final BaseAssembler<OrganizationModelAtoms, AddOrganizationModelAtomsDTO> baseAssembler;

    public OrganizationModelAtomsAssembler(@NotNull BaseAssemblerFactory baseAssemblerFactory) {
        this.baseAssembler = baseAssemblerFactory.getService(AddOrganizationModelAtomsDTO.class);
    }

    public OrganizationModelAtoms toEntity(AddOrganizationModelAtomsDTO addOrganizationModelAtomsDTO) {
        OrganizationModelAtoms organizationModelAtoms = new OrganizationModelAtoms();
        organizationModelAtoms = baseAssembler.toEntity(addOrganizationModelAtomsDTO, organizationModelAtoms);
        organizationModelAtoms.setName(addOrganizationModelAtomsDTO.getName());
        organizationModelAtoms.setCode(addOrganizationModelAtomsDTO.getCode());
        organizationModelAtoms.setTypeId(addOrganizationModelAtomsDTO.getTypeId());
        return organizationModelAtoms;
    }

    public AddOrganizationModelAtomsDTO toDTO(OrganizationModelAtoms organizationModelAtoms) {
        AddOrganizationModelAtomsDTO addOrganizationModelAtomsDTO = new AddOrganizationModelAtomsDTO();
        addOrganizationModelAtomsDTO = baseAssembler.toDTO(organizationModelAtoms, addOrganizationModelAtomsDTO);

        return addOrganizationModelAtomsDTO;
    }

}